const path = require("path");

function resolve(dir = "") {
    return path.join(__dirname, "./src", dir);
}

module.exports = {
    productionSourceMap: false,
    lintOnSave: false,
    /*devServer: {
      proxy: {
        '/api': {
          //target: 'http://127.0.0.1:3000',
          target: 'http://cdapi.klzhsq.cn',
          changeOrigin: true,
          pathRewrite: {
            //'^/api': '/src/api/'
            '^/api': ''
          }
        }
      }
    },*/
    chainWebpack: (config) => {
        config.plugins.delete("prefetch");
        config.plugins.delete("preload");
    },
    configureWebpack: {
        resolve: {
            // alias: {
            //   core: resolve('core')
            // }
        },
        optimization: {
            runtimeChunk: {
                name: (entrypoint) => `runtime~${entrypoint.name}`,
            },
            splitChunks: {
                minChunks: 2,
                minSize: 20000,
                maxAsyncRequests: 20,
                maxInitialRequests: 30,
                name: false,
            },
        },
    },
    css: {},
    devServer: {
        public: require("os").networkInterfaces()[
            Object.keys(require("os").networkInterfaces())[0]
        ][1].address + ":8080",
        disableHostCheck: false,
    },
    publicPath: "./",
};